<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 tdansitional//EN" "http://www.w3.org/td/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>产品列表</title>
<script type="text/javascript" src="/jquery_lib/jquery-1.8.2.min.js"></script>
</head>
	<script type="text/javascript">
		$(function(){
			$("#pro_id a[cmd=add]").click(function(){
				var tr = $(this).closest("tr");
				var tds = tr.find("td[cmd=text]");
				var values = [];
				for ( var int = 0; int < tds.length; int++) {
					values[int] = tds[int].innerHTML;
				}
				window.returnValue = values;
				window.close();
				//这个是JQUERY的迭代方法,里面用THIS代表每一个对象.
				/* tds.each(function(){
					//console.debug(arguments);
					$(this).html();
				}); */
			});
		});
	</script>

<body>
	<table border="1" width="100%" id="pro_id">
	<tr>
		<td>id</td>
		<td>sn</td>
		<td>名字</td>
		<td>价格</td>
		<td>操作</td>
	</tr>
	<s:iterator value="#products" >
		<tr>
			<td cmd="text"><s:property value="id"/></td>
			<td cmd="text"><s:property value="sn"/></td>
			<td cmd="text"><s:property value="name"/></td>
			<td cmd="text"><s:property value="price"/></td>
			<td><a href="javascript:" cmd="add"/>添加</a></td>
		</tr>
		</s:iterator>
	</table>
</body>
</html>